<?php include "header.php";?>
	<div id="all">
		<?php
			if($lang == 0){
				$sqlArticle = "Select id, vi_title as title, vi_content as content from tblArticle where id =" .$articleID; 
			}else{
				$sqlArticle = "Select id, en_title as title, en_content as content from tblArticle where id =" .$articleID; 
			}
			$rsArticle = mysql_query($sqlArticle) or die(mysql_error);
			$article = mysql_fetch_object($rsArticle);
			
		?>
		<div id="main">
			<div id="m-left">
				<?php
				$sqlMenu = "Select parent_id from tblmenu where url= '/view/".$article->id."'";
				$menu = mysql_fetch_object(mysql_query($sqlMenu)) or die(mysql_error());
				$sqlParentMenu =  "Select id, vi_name, en_name from tblmenu where id= ".$menu->parent_id;
				$parentMenu = mysql_fetch_object(mysql_query($sqlParentMenu)) or die(mysql_error());
				if($parentMenu->parent_id != 0){
					$sqlParentMenu =  "Select id, vi_name, en_name from tblmenu where id= ".$parentMenu->parent_id;
					$parentMenu = mysql_fetch_object(mysql_query($sqlParentMenu)) or die(mysql_error());
				}
				if($lang == 0){
					$sqlChildMenus = "Select id, vi_name as name from tblmenu where parent_id= ".$parentMenu->id;
				}else{
					$sqlChildMenus = "Select id, en_name as name from tblmenu where parent_id= ".$parentMenu->id;
				}
				$rsChildMenus = mysql_query($sqlChildMenus) or die(mysql_error());
				?>
				<div class="sidebar">
					<div class="title">
												
						<?php
							if($lang == 0){ 
								echo $parentMenu->vi_name;
							}else{
								echo $parentMenu->en_name;
							}
						?>
					</div>
					<div class="container">
						<ul>
						<?php
							while($childMenu = mysql_fetch_object($rsChildMenus)){
								echo "<li><a href='".(($childMenu->url =="")? (ROOT_PATH."/m/".$childMenu->id) : ROOT_PATH.$childMenu->url)."'>".$childMenu->name."</a></li>";					
							}
						?>
						</ul>
					</div>
				</div>
			</div>
			<div id="m-mid">
				<div class="title">
					<?php echo $article->title;?>
				</div>
				<div class="content">
					<?php echo $article->content;?>
				</div>
			</div>
			<div id="m-right">
			
				<div class="sidebar">
					<div class="title">
						<?php if($lang == 0){
							echo "Tin tức mới nhất";
						}else{
							echo "Newest news";
						}?>
					</div>
					<div class="container">
						<ul>
							<?php
								if($lang == 0){
									$sqlNews ="Select id,vi_title as title from tblarticle order by created_date desc Limit 5";
								}else{
									$sqlNews ="Select id,en_title as title from tblarticle order by created_date desc limit 5";
								}
								$rsNews = mysql_query($sqlNews) or die(mysql_error());
								while($news = mysql_fetch_object($rsNews)){
									echo "<li><a href='".ROOT_PATH."/view/".$news->id."'>".$news->title."</a></li>";
								}
								
							?>
							
						</ul>
					</div>
				</div>
			</div>
			<div class="clear-fix"></div>
		</div><!--  end of main -->
		<div id="footer">
			<div id="f-menu">
				<ul>
					<?php foreach($arrRootMenus as $rootMenu){
						if($lang ==0){
							echo "<li><a href='".ROOT_PATH.(($rootMenu->url=="")? "/m/".$rootMenu->id: ROOT_PATH."/".$rootMenu->url)."'>".$rootMenu->vi_name."</a></li>";
						}else{
							echo "<li><a href='".ROOT_PATH.(($rootMenu->url=="")? "/m/".$rootMenu->id: ROOT_PATH."/".$rootMenu->url)."'>".$rootMenu->en_name."</a></li>";
						}
					}?>
				</ul>
			</div>
			<div id="copyright">
				Bản quyền thuộc về khoa quốc tế đại học Thái Nguyên<br/>
				Copyright &copy; 2011 <a href="http://idgit.com.vn">Idea Development Group</a>
			</div>
			
		</div>
	</div>
</body>
</html>